<template>
 <div>
        <h1>智能柜系统设置</h1>
        <div>
        <h2>基础设置</h2>
          <el-form ref="form" :model="basicsetting" :rules="rules" label-width="80px">
          <el-form-item label="自动待机" prop="minute">
            <el-input v-model="basicsetting.minute" @change="xiu1"></el-input>
          </el-form-item>
          <el-form-item label="扫码下载快递员APP倒计时" prop="codescanner">
            <el-input v-model="basicsetting.codescanner" @change="xiu1"></el-input>
          </el-form-item>
          </el-form>
        </div>
        <div>
        <h2>派件设置</h2>
          <el-form ref="form" :model="deliverysetup" :rules="rules" label-width="80px">
            <el-form-item label="扫码登录倒计时" prop="smdltime">
              <el-input v-model="deliverysetup.smdltime" @change="xiu3"></el-input>
            </el-form-item>
            <el-form-item label="手机号登录输入手机号倒计时" prop="sjhtime">
              <el-input v-model="deliverysetup.sjhtime" @change="xiu3"></el-input>
            </el-form-item>
            <el-form-item label="输入收件人手机号倒计时" prop="srsjhmdjs">
              <el-input v-model="deliverysetup.srsjhmdjs" @change="xiu3"></el-input>
            </el-form-item>
            <el-form-item label="柜门开始倒计时" prop="gmdjs">
              <el-input v-model="deliverysetup.gmdjs" @change="xiu3"></el-input>
            </el-form-item>
            <el-form-item label="手机号登录输入密码倒计时" prop="sjhdlmmdjs">
              <el-input v-model="deliverysetup.sjhdlmmdjs" @change="xiu3"></el-input>
            </el-form-item>
            <el-form-item label="支付倒计时" prop="zfdjs">
              <el-input v-model="deliverysetup.zfdjs" @change="xiu3"></el-input>
            </el-form-item>
            <el-form-item label="派件成功自动" prop="pjcgzdzxdjs">
              <el-input v-model="deliverysetup.pjcgzdzxdjs" @change="xiu3"></el-input>
            </el-form-item>
          </el-form>
        </div>
        <div>
        <h2>取件设置</h2>
          <el-form ref="form" :model="collectset" :rules="rules" label-width="80px">
          <el-form-item label="取件码有效期" prop="qjmyxtime">
            <el-input v-model="collectset.qjmyxtime" @change="xiu2"></el-input>
          </el-form-item>
          <el-form-item label="输入取件码倒计时" prop="srqjmyxqi">
            <el-input v-model="collectset.srqjmyxqi" @change="xiu2"></el-input>
          </el-form-item>
          <el-form-item label="输入手机号倒计时" prop="srsjhmdjs">
            <el-input v-model="collectset.srsjhmdjs" @change="xiu2"></el-input>
          </el-form-item>
          <el-form-item label="输入验证码倒计时" prop="smqjmddjs">
            <el-input v-model="collectset.smqjmddjs" @change="xiu2"></el-input>
          </el-form-item>
          <el-form-item label="扫码取件倒计时" prop="smqjmddjs">
            <el-input v-model="collectset.srqjmddjs" @change="xiu2"></el-input>
          </el-form-item>
          <el-form-item label="柜门开启倒计时" prop="gmkqdjs">
            <el-input v-model="collectset.gmkqdjs" @change="xiu2"></el-input>
          </el-form-item>
          <el-form-item label="取件成功自动返回倒计时" prop="qjcgzddjs">
            <el-input v-model="collectset.qjcgzddjs" @change="xiu2"></el-input>
          </el-form-item>
          </el-form>
        </div>
 </div>
</template>

<script>
import {getUser} from "@/api/user/login"
import { h } from 'vue';
import axios from "axios";
export default {
  data() {
    return {
      //基础设置
      basicsetting:{
        id:1,
        minute:null,
        codescanner:null,
      },
      //取件设置
      collectset:{
        id:1,
        qjmyxtime:null,
        srqjmyxqi:null,
        srsjhmdjs:null,
        smqjmddjs:null,
        gmkqdjs:null,
        qjcgzddjs:null,
        srqjmddjs:null,
      },
      //派件设置
      deliverysetup:{
        id:1,
        smdltime:null,
        sjhtime:null,
        srsjhmdjs:null,
        gmdjs:null,
        sjhdlmmdjs:null,
        zfdjs:null,
        pjcgzdzxdjs:null
      },
      form:{},
      rules:{},
      activeIndex: '8',
      name: sessionStorage.getItem("name"),
    };
  },
  created() {
    this.cha2();
    this.cha3();
    this.enene();
    this.cha1();
  },
  methods: {
    login() {
      getUser().then(res => {
        console.log(res);
      });
    },
    xitong(){
      this.$router.push(
          {path: "/OutSystems"}
      )
    },
    cha1(){
       axios.post("http://localhost:10062/system/kan3").then(res =>{
         this.deliverysetup=res.data;
      })
    },
    enene(){
       h('div', { class: 'my-class' }, 'Hello World');
    },
    cha2(){
      axios.post("http://localhost:10062/system/kan2").then(res =>{
        this.collectset=res.data;
      })
    },
    ba(){
      this.$router.push(
          {path: "/dropdown"}
      )
    },
    cha3(){
      axios.post("http://localhost:10062/system/kan1").then(res =>{
        this.basicsetting=res.data;
      })
    },
    dshezhi(){
      this.$router.push(
          {path: "/outkey"}
      )
    },
    xiu1(){
      axios.post("http://localhost:10062/system/gai1",this.basicsetting).then(res =>{
        console.log(res);
        this.$message({
          message: '恭喜你，这是一条成功消息',
          type: 'success'
        });
      })
    },
    xiu2(){
      axios.post("http://localhost:10062/system/gai2",this.collectset).then(res =>{
        console.log(res);
        this.$message({
          message: '恭喜你，这是一条成功消息',
          type: 'success'
        });
      })
    },
    xiu3(){
      axios.post("http://localhost:10062/system/gai3",this.deliverysetup).then(res =>{
        console.log(res);
        this.$message({
          message: '恭喜你，这是一条成功消息',
          type: 'success'
        });
      })
    },
    expressList(){
      this.$router.push(
          {path: "/expressList"}
      )
    },
    baocc(){
      this.$router.push(
          {path: "/OutPackage"}
      )
    },
    handleSelect(key) {
      console.log(key);
    },
    notice() {
      this.$router.push(
          {path: "/HomePage"}
      )
    },
    //跳转其他页面
    other() {
      this.$router.push(
          {path: "/otherView"}
      )
    }
  }
};
</script>

<style lang="less">
#app {
  margin-top: 0;
}

.home-container {
  height: 100%;
}

.el-header {
  background-color: #545c64;
  display: flex; //设置显示为flex布局
  justify-content: space-between; //设置为flex左右布局
  padding-left: 0; //左内边距为0（Logo贴左边）
  align-items: center; //元素上下居中（防止右边按钮贴上下边）
  color: #fff;
  font-size: 18px;

  > div {
    //内嵌的div样式
    display: flex;
    align-items: center; //Logo和文字上下居中
    #fontLogo {
      width: 200px;
      margin-left: 10px; //文字左侧设置间距，防止与Logo紧贴
    }
    #fontName {
      width: 120px;
      margin-right: 10px;
    }
  }
}

#indexMenu {
  width: 100%;
}

.el-menu {
  background-color: #545c64;
}

.el-aside {
  background-color: #545c64;
  scrollbar-width: none; /* firefox */
  -ms-overflow-style: none; /* IE 10+ */
  overflow-x: hidden;
  overflow-y: auto;
}

.el-main {
  background-color: #eaedf1;
  height: 1000px;
}
</style>
